<?php

// Global variable for table object
$noticias = NULL;

//
// Table class for noticias
//
class cnoticias extends cTable {
	var $not_id;
	var $not_fecha;
	var $not_hora;
	var $not_seccion;
	var $not_orden;
	var $not_copete;
	var $not_titulo;
	var $not_resumens;
	var $not_contenido;
	var $not_imagen;
	var $not_epi;
	var $not_audio;
	var $not_url;
	var $not_publicar;
	var $not_fecha_pub;
	var $not_hora_pub;
	var $not_fuente1;
	var $not_fuente;
	var $not_galeria;
	var $not_destacada;
	var $not_visitas;
	var $not_publicar_index;
	var $not_autor;
	var $not_usuario;
	var $not_relacionadas;

	//
	// Table class constructor
	//
	function __construct() {
		global $Language;

		// Language object
		if (!isset($Language)) $Language = new cLanguage();
		$this->TableVar = 'noticias';
		$this->TableName = 'noticias';
		$this->TableType = 'TABLE';
		$this->ExportAll = TRUE;
		$this->ExportPageBreakCount = 0; // Page break per every n record (PDF only)
		$this->ExportPageOrientation = "portrait"; // Page orientation (PDF only)
		$this->ExportPageSize = "a4"; // Page size (PDF only)
		$this->DetailAdd = FALSE; // Allow detail add
		$this->DetailEdit = FALSE; // Allow detail edit
		$this->DetailView = TRUE; // Allow detail view
		$this->ShowMultipleDetails = FALSE; // Show multiple details
		$this->GridAddRowCount = 5;
		$this->AllowAddDeleteRow = ew_AllowAddDeleteRow(); // Allow add/delete row
		$this->UserIDAllowSecurity = 0; // User ID Allow
		$this->BasicSearch = new cBasicSearch($this->TableVar);

		// not_id
		$this->not_id = new cField('noticias', 'noticias', 'x_not_id', 'not_id', '`not_id`', '`not_id`', 19, -1, FALSE, '`not_id`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->not_id->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
		$this->fields['not_id'] = &$this->not_id;

		// not_fecha
		$this->not_fecha = new cField('noticias', 'noticias', 'x_not_fecha', 'not_fecha', '`not_fecha`', 'DATE_FORMAT(`not_fecha`, \'%d/%m/%Y\')', 133, 7, FALSE, '`not_fecha`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->not_fecha->FldDefaultErrMsg = str_replace("%s", "/", $Language->Phrase("IncorrectDateDMY"));
		$this->fields['not_fecha'] = &$this->not_fecha;

		// not_hora
		$this->not_hora = new cField('noticias', 'noticias', 'x_not_hora', 'not_hora', '`not_hora`', 'DATE_FORMAT(`not_hora`, \'%d/%m/%Y\')', 134, -1, FALSE, '`not_hora`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->not_hora->FldDefaultErrMsg = $Language->Phrase("IncorrectTime");
		$this->fields['not_hora'] = &$this->not_hora;

		// not_seccion
		$this->not_seccion = new cField('noticias', 'noticias', 'x_not_seccion', 'not_seccion', '`not_seccion`', '`not_seccion`', 19, -1, FALSE, '`not_seccion`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->not_seccion->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
		$this->fields['not_seccion'] = &$this->not_seccion;

		// not_orden
		$this->not_orden = new cField('noticias', 'noticias', 'x_not_orden', 'not_orden', '`not_orden`', '`not_orden`', 19, -1, FALSE, '`not_orden`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->not_orden->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
		$this->fields['not_orden'] = &$this->not_orden;

		// not_copete
		$this->not_copete = new cField('noticias', 'noticias', 'x_not_copete', 'not_copete', '`not_copete`', '`not_copete`', 200, -1, FALSE, '`not_copete`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->fields['not_copete'] = &$this->not_copete;

		// not_titulo
		$this->not_titulo = new cField('noticias', 'noticias', 'x_not_titulo', 'not_titulo', '`not_titulo`', '`not_titulo`', 200, -1, FALSE, '`not_titulo`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->fields['not_titulo'] = &$this->not_titulo;

		// not_resumens
		$this->not_resumens = new cField('noticias', 'noticias', 'x_not_resumens', 'not_resumens', '`not_resumens`', '`not_resumens`', 201, -1, FALSE, '`not_resumens`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->fields['not_resumens'] = &$this->not_resumens;

		// not_contenido
		$this->not_contenido = new cField('noticias', 'noticias', 'x_not_contenido', 'not_contenido', '`not_contenido`', '`not_contenido`', 201, -1, FALSE, '`not_contenido`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->fields['not_contenido'] = &$this->not_contenido;

		// not_imagen
		$this->not_imagen = new cField('noticias', 'noticias', 'x_not_imagen', 'not_imagen', '`not_imagen`', '`not_imagen`', 200, -1, TRUE, '`not_imagen`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->fields['not_imagen'] = &$this->not_imagen;

		// not_epi
		$this->not_epi = new cField('noticias', 'noticias', 'x_not_epi', 'not_epi', '`not_epi`', '`not_epi`', 200, -1, FALSE, '`not_epi`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->fields['not_epi'] = &$this->not_epi;

		// not_audio
		$this->not_audio = new cField('noticias', 'noticias', 'x_not_audio', 'not_audio', '`not_audio`', '`not_audio`', 200, -1, TRUE, '`not_audio`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->fields['not_audio'] = &$this->not_audio;

		// not_url
		$this->not_url = new cField('noticias', 'noticias', 'x_not_url', 'not_url', '`not_url`', '`not_url`', 200, -1, FALSE, '`not_url`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->fields['not_url'] = &$this->not_url;

		// not_publicar
		$this->not_publicar = new cField('noticias', 'noticias', 'x_not_publicar', 'not_publicar', '`not_publicar`', '`not_publicar`', 3, -1, FALSE, '`not_publicar`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->not_publicar->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
		$this->fields['not_publicar'] = &$this->not_publicar;

		// not_fecha_pub
		$this->not_fecha_pub = new cField('noticias', 'noticias', 'x_not_fecha_pub', 'not_fecha_pub', '`not_fecha_pub`', 'DATE_FORMAT(`not_fecha_pub`, \'%d/%m/%Y\')', 133, 7, FALSE, '`not_fecha_pub`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->not_fecha_pub->FldDefaultErrMsg = str_replace("%s", "/", $Language->Phrase("IncorrectDateDMY"));
		$this->fields['not_fecha_pub'] = &$this->not_fecha_pub;

		// not_hora_pub
		$this->not_hora_pub = new cField('noticias', 'noticias', 'x_not_hora_pub', 'not_hora_pub', '`not_hora_pub`', 'DATE_FORMAT(`not_hora_pub`, \'%d/%m/%Y\')', 134, -1, FALSE, '`not_hora_pub`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->not_hora_pub->FldDefaultErrMsg = $Language->Phrase("IncorrectTime");
		$this->fields['not_hora_pub'] = &$this->not_hora_pub;

		// not_fuente1
		$this->not_fuente1 = new cField('noticias', 'noticias', 'x_not_fuente1', 'not_fuente1', '`not_fuente1`', '`not_fuente1`', 3, -1, FALSE, '`not_fuente1`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->not_fuente1->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
		$this->fields['not_fuente1'] = &$this->not_fuente1;

		// not_fuente
		$this->not_fuente = new cField('noticias', 'noticias', 'x_not_fuente', 'not_fuente', '`not_fuente`', '`not_fuente`', 200, -1, FALSE, '`not_fuente`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->fields['not_fuente'] = &$this->not_fuente;

		// not_galeria
		$this->not_galeria = new cField('noticias', 'noticias', 'x_not_galeria', 'not_galeria', '`not_galeria`', '`not_galeria`', 3, -1, FALSE, '`not_galeria`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->not_galeria->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
		$this->fields['not_galeria'] = &$this->not_galeria;

		// not_destacada
		$this->not_destacada = new cField('noticias', 'noticias', 'x_not_destacada', 'not_destacada', '`not_destacada`', '`not_destacada`', 3, -1, FALSE, '`not_destacada`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->not_destacada->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
		$this->fields['not_destacada'] = &$this->not_destacada;

		// not_visitas
		$this->not_visitas = new cField('noticias', 'noticias', 'x_not_visitas', 'not_visitas', '`not_visitas`', '`not_visitas`', 3, -1, FALSE, '`not_visitas`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->not_visitas->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
		$this->fields['not_visitas'] = &$this->not_visitas;

		// not_publicar_index
		$this->not_publicar_index = new cField('noticias', 'noticias', 'x_not_publicar_index', 'not_publicar_index', '`not_publicar_index`', '`not_publicar_index`', 3, -1, FALSE, '`not_publicar_index`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->not_publicar_index->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
		$this->fields['not_publicar_index'] = &$this->not_publicar_index;

		// not_autor
		$this->not_autor = new cField('noticias', 'noticias', 'x_not_autor', 'not_autor', '`not_autor`', '`not_autor`', 200, -1, FALSE, '`not_autor`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->fields['not_autor'] = &$this->not_autor;

		// not_usuario
		$this->not_usuario = new cField('noticias', 'noticias', 'x_not_usuario', 'not_usuario', '`not_usuario`', '`not_usuario`', 3, -1, FALSE, '`not_usuario`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->not_usuario->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
		$this->fields['not_usuario'] = &$this->not_usuario;

		// not_relacionadas
		$this->not_relacionadas = new cField('noticias', 'noticias', 'x_not_relacionadas', 'not_relacionadas', '`not_relacionadas`', '`not_relacionadas`', 200, -1, FALSE, '`not_relacionadas`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->fields['not_relacionadas'] = &$this->not_relacionadas;
	}

	// Single column sort
	function UpdateSort(&$ofld) {
		if ($this->CurrentOrder == $ofld->FldName) {
			$sSortField = $ofld->FldExpression;
			$sLastSort = $ofld->getSort();
			if ($this->CurrentOrderType == "ASC" || $this->CurrentOrderType == "DESC") {
				$sThisSort = $this->CurrentOrderType;
			} else {
				$sThisSort = ($sLastSort == "ASC") ? "DESC" : "ASC";
			}
			$ofld->setSort($sThisSort);
			$this->setSessionOrderBy($sSortField . " " . $sThisSort); // Save to Session
		} else {
			$ofld->setSort("");
		}
	}

	// Table level SQL
	function SqlFrom() { // From
		return "`noticias`";
	}

	function SqlSelect() { // Select
		return "SELECT * FROM " . $this->SqlFrom();
	}

	function SqlWhere() { // Where
		$sWhere = "";
		$this->TableFilter = "";
		ew_AddFilter($sWhere, $this->TableFilter);
		return $sWhere;
	}

	function SqlGroupBy() { // Group By
		return "";
	}

	function SqlHaving() { // Having
		return "";
	}

	function SqlOrderBy() { // Order By
		return "`not_fecha` DESC";
	}

	// Check if Anonymous User is allowed
	function AllowAnonymousUser() {
		switch (@$this->PageID) {
			case "add":
			case "register":
			case "addopt":
				return FALSE;
			case "edit":
			case "update":
			case "changepwd":
			case "forgotpwd":
				return FALSE;
			case "delete":
				return FALSE;
			case "view":
				return FALSE;
			case "search":
				return FALSE;
			default:
				return FALSE;
		}
	}

	// Apply User ID filters
	function ApplyUserIDFilters($sFilter) {
		return $sFilter;
	}

	// Check if User ID security allows view all
	function UserIDAllow($id = "") {
		$allow = EW_USER_ID_ALLOW;
		switch ($id) {
			case "add":
			case "copy":
			case "gridadd":
			case "register":
			case "addopt":
				return (($allow & 1) == 1);
			case "edit":
			case "gridedit":
			case "update":
			case "changepwd":
			case "forgotpwd":
				return (($allow & 4) == 4);
			case "delete":
				return (($allow & 2) == 2);
			case "view":
				return (($allow & 8) == 8);
			case "search":
				return (($allow & 8) == 8);
			default:
				return (($allow & 8) == 8);
		}
	}

	// Get SQL
	function GetSQL($where, $orderby) {
		return ew_BuildSelectSql($this->SqlSelect(), $this->SqlWhere(),
			$this->SqlGroupBy(), $this->SqlHaving(), $this->SqlOrderBy(),
			$where, $orderby);
	}

	// Table SQL
	function SQL() {
		$sFilter = $this->CurrentFilter;
		$sFilter = $this->ApplyUserIDFilters($sFilter);
		$sSort = $this->getSessionOrderBy();
		return ew_BuildSelectSql($this->SqlSelect(), $this->SqlWhere(),
			$this->SqlGroupBy(), $this->SqlHaving(), $this->SqlOrderBy(),
			$sFilter, $sSort);
	}

	// Table SQL with List page filter
	function SelectSQL() {
		$sFilter = $this->getSessionWhere();
		ew_AddFilter($sFilter, $this->CurrentFilter);
		$sFilter = $this->ApplyUserIDFilters($sFilter);
		$sSort = $this->getSessionOrderBy();
		return ew_BuildSelectSql($this->SqlSelect(), $this->SqlWhere(), $this->SqlGroupBy(),
			$this->SqlHaving(), $this->SqlOrderBy(), $sFilter, $sSort);
	}

	// Get ORDER BY clause
	function GetOrderBy() {
		$sSort = $this->getSessionOrderBy();
		return ew_BuildSelectSql("", "", "", "", $this->SqlOrderBy(), "", $sSort);
	}

	// Try to get record count
	function TryGetRecordCount($sSql) {
		global $conn;
		$cnt = -1;
		if ($this->TableType == 'TABLE' || $this->TableType == 'VIEW') {
			$sSql = "SELECT COUNT(*) FROM" . substr($sSql, 13);
			$sOrderBy = $this->GetOrderBy();
			if (substr($sSql, strlen($sOrderBy) * -1) == $sOrderBy)
				$sSql = substr($sSql, 0, strlen($sSql) - strlen($sOrderBy)); // Remove ORDER BY clause
		} else {
			$sSql = "SELECT COUNT(*) FROM (" . $sSql . ") EW_COUNT_TABLE";
		}
		if ($rs = $conn->Execute($sSql)) {
			if (!$rs->EOF && $rs->FieldCount() > 0) {
				$cnt = $rs->fields[0];
				$rs->Close();
			}
		}
		return intval($cnt);
	}

	// Get record count based on filter (for detail record count in master table pages)
	function LoadRecordCount($sFilter) {
		$origFilter = $this->CurrentFilter;
		$this->CurrentFilter = $sFilter;
		$this->Recordset_Selecting($this->CurrentFilter);

		//$sSql = $this->SQL();
		$sSql = $this->GetSQL($this->CurrentFilter, "");
		$cnt = $this->TryGetRecordCount($sSql);
		if ($cnt == -1) {
			if ($rs = $this->LoadRs($this->CurrentFilter)) {
				$cnt = $rs->RecordCount();
				$rs->Close();
			}
		}
		$this->CurrentFilter = $origFilter;
		return intval($cnt);
	}

	// Get record count (for current List page)
	function SelectRecordCount() {
		global $conn;
		$origFilter = $this->CurrentFilter;
		$this->Recordset_Selecting($this->CurrentFilter);
		$sSql = $this->SelectSQL();
		$cnt = $this->TryGetRecordCount($sSql);
		if ($cnt == -1) {
			if ($rs = $conn->Execute($sSql)) {
				$cnt = $rs->RecordCount();
				$rs->Close();
			}
		}
		$this->CurrentFilter = $origFilter;
		return intval($cnt);
	}

	// Update Table
	var $UpdateTable = "`noticias`";

	// INSERT statement
	function InsertSQL(&$rs) {
		global $conn;
		$names = "";
		$values = "";
		foreach ($rs as $name => $value) {
			if (!isset($this->fields[$name]))
				continue;
			$names .= $this->fields[$name]->FldExpression . ",";
			$values .= ew_QuotedValue($value, $this->fields[$name]->FldDataType) . ",";
		}
		while (substr($names, -1) == ",")
			$names = substr($names, 0, -1);
		while (substr($values, -1) == ",")
			$values = substr($values, 0, -1);
		return "INSERT INTO " . $this->UpdateTable . " ($names) VALUES ($values)";
	}

	// Insert
	function Insert(&$rs) {
		global $conn;
		return $conn->Execute($this->InsertSQL($rs));
	}

	// UPDATE statement
	function UpdateSQL(&$rs, $where = "") {
		$sql = "UPDATE " . $this->UpdateTable . " SET ";
		foreach ($rs as $name => $value) {
			if (!isset($this->fields[$name]))
				continue;
			$sql .= $this->fields[$name]->FldExpression . "=";
			$sql .= ew_QuotedValue($value, $this->fields[$name]->FldDataType) . ",";
		}
		while (substr($sql, -1) == ",")
			$sql = substr($sql, 0, -1);
		$filter = $this->CurrentFilter;
		ew_AddFilter($filter, $where);
		if ($filter <> "")	$sql .= " WHERE " . $filter;
		return $sql;
	}

	// Update
	function Update(&$rs, $where = "", $rsold = NULL) {
		global $conn;
		return $conn->Execute($this->UpdateSQL($rs, $where));
	}

	// DELETE statement
	function DeleteSQL(&$rs, $where = "") {
		$sql = "DELETE FROM " . $this->UpdateTable . " WHERE ";
		if ($rs) {
			if (array_key_exists('not_id', $rs))
				ew_AddFilter($where, ew_QuotedName('not_id') . '=' . ew_QuotedValue($rs['not_id'], $this->not_id->FldDataType));
		}
		$filter = $this->CurrentFilter;
		ew_AddFilter($filter, $where);
		if ($filter <> "")
			$sql .= $filter;
		else
			$sql .= "0=1"; // Avoid delete
		return $sql;
	}

	// Delete
	function Delete(&$rs, $where = "") {
		global $conn;
		return $conn->Execute($this->DeleteSQL($rs, $where));
	}

	// Key filter WHERE clause
	function SqlKeyFilter() {
		return "`not_id` = @not_id@";
	}

	// Key filter
	function KeyFilter() {
		$sKeyFilter = $this->SqlKeyFilter();
		if (!is_numeric($this->not_id->CurrentValue))
			$sKeyFilter = "0=1"; // Invalid key
		$sKeyFilter = str_replace("@not_id@", ew_AdjustSql($this->not_id->CurrentValue), $sKeyFilter); // Replace key value
		return $sKeyFilter;
	}

	// Return page URL
	function getReturnUrl() {
		$name = EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_RETURN_URL;

		// Get referer URL automatically
		if (ew_ServerVar("HTTP_REFERER") <> "" && ew_ReferPage() <> ew_CurrentPage() && ew_ReferPage() <> "login.php") // Referer not same page or login page
			$_SESSION[$name] = ew_ServerVar("HTTP_REFERER"); // Save to Session
		if (@$_SESSION[$name] <> "") {
			return $_SESSION[$name];
		} else {
			return "noticiaslist.php";
		}
	}

	function setReturnUrl($v) {
		$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_RETURN_URL] = $v;
	}

	// List URL
	function GetListUrl() {
		return "noticiaslist.php";
	}

	// View URL
	function GetViewUrl($parm = "") {
		if ($parm <> "")
			return $this->KeyUrl("noticiasview.php", $this->UrlParm($parm));
		else
			return $this->KeyUrl("noticiasview.php", $this->UrlParm(EW_TABLE_SHOW_DETAIL . "="));
	}

	// Add URL
	function GetAddUrl() {
		return "noticiasadd.php";
	}

	// Edit URL
	function GetEditUrl($parm = "") {
		return $this->KeyUrl("noticiasedit.php", $this->UrlParm($parm));
	}

	// Inline edit URL
	function GetInlineEditUrl() {
		return $this->KeyUrl(ew_CurrentPage(), $this->UrlParm("a=edit"));
	}

	// Copy URL
	function GetCopyUrl($parm = "") {
		return $this->KeyUrl("noticiasadd.php", $this->UrlParm($parm));
	}

	// Inline copy URL
	function GetInlineCopyUrl() {
		return $this->KeyUrl(ew_CurrentPage(), $this->UrlParm("a=copy"));
	}

	// Delete URL
	function GetDeleteUrl() {
		return $this->KeyUrl("noticiasdelete.php", $this->UrlParm());
	}

	// Add key value to URL
	function KeyUrl($url, $parm = "") {
		$sUrl = $url . "?";
		if ($parm <> "") $sUrl .= $parm . "&";
		if (!is_null($this->not_id->CurrentValue)) {
			$sUrl .= "not_id=" . urlencode($this->not_id->CurrentValue);
		} else {
			return "javascript:alert(ewLanguage.Phrase('InvalidRecord'));";
		}
		return $sUrl;
	}

	// Sort URL
	function SortUrl(&$fld) {
		if ($this->CurrentAction <> "" || $this->Export <> "" ||
			in_array($fld->FldType, array(128, 204, 205))) { // Unsortable data type
				return "";
		} elseif ($fld->Sortable) {
			$sUrlParm = $this->UrlParm("order=" . urlencode($fld->FldName) . "&amp;ordertype=" . $fld->ReverseSort());
			return ew_CurrentPage() . "?" . $sUrlParm;
		} else {
			return "";
		}
	}

	// Get record keys from $_POST/$_GET/$_SESSION
	function GetRecordKeys() {
		global $EW_COMPOSITE_KEY_SEPARATOR;
		$arKeys = array();
		$arKey = array();
		if (isset($_POST["key_m"])) {
			$arKeys = ew_StripSlashes($_POST["key_m"]);
			$cnt = count($arKeys);
		} elseif (isset($_GET["key_m"])) {
			$arKeys = ew_StripSlashes($_GET["key_m"]);
			$cnt = count($arKeys);
		} elseif (isset($_GET)) {
			$arKeys[] = @$_GET["not_id"]; // not_id

			//return $arKeys; // Do not return yet, so the values will also be checked by the following code
		}

		// Check keys
		$ar = array();
		foreach ($arKeys as $key) {
			if (!is_numeric($key))
				continue;
			$ar[] = $key;
		}
		return $ar;
	}

	// Get key filter
	function GetKeyFilter() {
		$arKeys = $this->GetRecordKeys();
		$sKeyFilter = "";
		foreach ($arKeys as $key) {
			if ($sKeyFilter <> "") $sKeyFilter .= " OR ";
			$this->not_id->CurrentValue = $key;
			$sKeyFilter .= "(" . $this->KeyFilter() . ")";
		}
		return $sKeyFilter;
	}

	// Load rows based on filter
	function &LoadRs($sFilter) {
		global $conn;

		// Set up filter (SQL WHERE clause) and get return SQL
		//$this->CurrentFilter = $sFilter;
		//$sSql = $this->SQL();

		$sSql = $this->GetSQL($sFilter, "");
		$rs = $conn->Execute($sSql);
		return $rs;
	}

	// Load row values from recordset
	function LoadListRowValues(&$rs) {
		$this->not_id->setDbValue($rs->fields('not_id'));
		$this->not_fecha->setDbValue($rs->fields('not_fecha'));
		$this->not_hora->setDbValue($rs->fields('not_hora'));
		$this->not_seccion->setDbValue($rs->fields('not_seccion'));
		$this->not_orden->setDbValue($rs->fields('not_orden'));
		$this->not_copete->setDbValue($rs->fields('not_copete'));
		$this->not_titulo->setDbValue($rs->fields('not_titulo'));
		$this->not_resumens->setDbValue($rs->fields('not_resumens'));
		$this->not_contenido->setDbValue($rs->fields('not_contenido'));
		$this->not_imagen->Upload->DbValue = $rs->fields('not_imagen');
		$this->not_epi->setDbValue($rs->fields('not_epi'));
		$this->not_audio->Upload->DbValue = $rs->fields('not_audio');
		$this->not_url->setDbValue($rs->fields('not_url'));
		$this->not_publicar->setDbValue($rs->fields('not_publicar'));
		$this->not_fecha_pub->setDbValue($rs->fields('not_fecha_pub'));
		$this->not_hora_pub->setDbValue($rs->fields('not_hora_pub'));
		$this->not_fuente1->setDbValue($rs->fields('not_fuente1'));
		$this->not_fuente->setDbValue($rs->fields('not_fuente'));
		$this->not_galeria->setDbValue($rs->fields('not_galeria'));
		$this->not_destacada->setDbValue($rs->fields('not_destacada'));
		$this->not_visitas->setDbValue($rs->fields('not_visitas'));
		$this->not_publicar_index->setDbValue($rs->fields('not_publicar_index'));
		$this->not_autor->setDbValue($rs->fields('not_autor'));
		$this->not_usuario->setDbValue($rs->fields('not_usuario'));
		$this->not_relacionadas->setDbValue($rs->fields('not_relacionadas'));
	}

	// Render list row values
	function RenderListRow() {
		global $conn, $Security;

		// Call Row Rendering event
		$this->Row_Rendering();

   // Common render codes
		// not_id
		// not_fecha
		// not_hora
		// not_seccion
		// not_orden
		// not_copete
		// not_titulo
		// not_resumens
		// not_contenido
		// not_imagen
		// not_epi
		// not_audio
		// not_url
		// not_publicar
		// not_fecha_pub
		// not_hora_pub
		// not_fuente1
		// not_fuente
		// not_galeria
		// not_destacada
		// not_visitas
		// not_publicar_index
		// not_autor
		// not_usuario
		// not_relacionadas
		// not_id

		$this->not_id->ViewValue = $this->not_id->CurrentValue;
		$this->not_id->ViewCustomAttributes = "";

		// not_fecha
		$this->not_fecha->ViewValue = $this->not_fecha->CurrentValue;
		$this->not_fecha->ViewValue = ew_FormatDateTime($this->not_fecha->ViewValue, 7);
		$this->not_fecha->ViewCustomAttributes = "";

		// not_hora
		$this->not_hora->ViewValue = $this->not_hora->CurrentValue;
		$this->not_hora->ViewCustomAttributes = "";

		// not_seccion
		if (strval($this->not_seccion->CurrentValue) <> "") {
			$sFilterWrk = "`sec_id`" . ew_SearchString("=", $this->not_seccion->CurrentValue, EW_DATATYPE_NUMBER);
		$sSqlWrk = "SELECT `sec_id`, `sec_nombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `secciones`";
		$sWhereWrk = "";
		if ($sFilterWrk <> "") {
			ew_AddFilter($sWhereWrk, $sFilterWrk);
		}

		// Call Lookup selecting
		$this->Lookup_Selecting($this->not_seccion, $sWhereWrk);
		if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
		$sSqlWrk .= " ORDER BY `sec_nombre` Asc";
			$rswrk = $conn->Execute($sSqlWrk);
			if ($rswrk && !$rswrk->EOF) { // Lookup values found
				$this->not_seccion->ViewValue = $rswrk->fields('DispFld');
				$rswrk->Close();
			} else {
				$this->not_seccion->ViewValue = $this->not_seccion->CurrentValue;
			}
		} else {
			$this->not_seccion->ViewValue = NULL;
		}
		$this->not_seccion->ViewCustomAttributes = "";

		// not_orden
		if (strval($this->not_orden->CurrentValue) <> "") {
			switch ($this->not_orden->CurrentValue) {
				case $this->not_orden->FldTagValue(1):
					$this->not_orden->ViewValue = $this->not_orden->FldTagCaption(1) <> "" ? $this->not_orden->FldTagCaption(1) : $this->not_orden->CurrentValue;
					break;
				case $this->not_orden->FldTagValue(2):
					$this->not_orden->ViewValue = $this->not_orden->FldTagCaption(2) <> "" ? $this->not_orden->FldTagCaption(2) : $this->not_orden->CurrentValue;
					break;
				case $this->not_orden->FldTagValue(3):
					$this->not_orden->ViewValue = $this->not_orden->FldTagCaption(3) <> "" ? $this->not_orden->FldTagCaption(3) : $this->not_orden->CurrentValue;
					break;
				case $this->not_orden->FldTagValue(4):
					$this->not_orden->ViewValue = $this->not_orden->FldTagCaption(4) <> "" ? $this->not_orden->FldTagCaption(4) : $this->not_orden->CurrentValue;
					break;
				case $this->not_orden->FldTagValue(5):
					$this->not_orden->ViewValue = $this->not_orden->FldTagCaption(5) <> "" ? $this->not_orden->FldTagCaption(5) : $this->not_orden->CurrentValue;
					break;
				case $this->not_orden->FldTagValue(6):
					$this->not_orden->ViewValue = $this->not_orden->FldTagCaption(6) <> "" ? $this->not_orden->FldTagCaption(6) : $this->not_orden->CurrentValue;
					break;
				case $this->not_orden->FldTagValue(7):
					$this->not_orden->ViewValue = $this->not_orden->FldTagCaption(7) <> "" ? $this->not_orden->FldTagCaption(7) : $this->not_orden->CurrentValue;
					break;
				case $this->not_orden->FldTagValue(8):
					$this->not_orden->ViewValue = $this->not_orden->FldTagCaption(8) <> "" ? $this->not_orden->FldTagCaption(8) : $this->not_orden->CurrentValue;
					break;
				case $this->not_orden->FldTagValue(9):
					$this->not_orden->ViewValue = $this->not_orden->FldTagCaption(9) <> "" ? $this->not_orden->FldTagCaption(9) : $this->not_orden->CurrentValue;
					break;
				case $this->not_orden->FldTagValue(10):
					$this->not_orden->ViewValue = $this->not_orden->FldTagCaption(10) <> "" ? $this->not_orden->FldTagCaption(10) : $this->not_orden->CurrentValue;
					break;
				case $this->not_orden->FldTagValue(11):
					$this->not_orden->ViewValue = $this->not_orden->FldTagCaption(11) <> "" ? $this->not_orden->FldTagCaption(11) : $this->not_orden->CurrentValue;
					break;
				case $this->not_orden->FldTagValue(12):
					$this->not_orden->ViewValue = $this->not_orden->FldTagCaption(12) <> "" ? $this->not_orden->FldTagCaption(12) : $this->not_orden->CurrentValue;
					break;
				case $this->not_orden->FldTagValue(13):
					$this->not_orden->ViewValue = $this->not_orden->FldTagCaption(13) <> "" ? $this->not_orden->FldTagCaption(13) : $this->not_orden->CurrentValue;
					break;
				default:
					$this->not_orden->ViewValue = $this->not_orden->CurrentValue;
			}
		} else {
			$this->not_orden->ViewValue = NULL;
		}
		$this->not_orden->ViewCustomAttributes = "";

		// not_copete
		$this->not_copete->ViewValue = $this->not_copete->CurrentValue;
		$this->not_copete->ViewCustomAttributes = "";

		// not_titulo
		$this->not_titulo->ViewValue = $this->not_titulo->CurrentValue;
		$this->not_titulo->ViewCustomAttributes = "";

		// not_resumens
		$this->not_resumens->ViewValue = $this->not_resumens->CurrentValue;
		$this->not_resumens->ViewCustomAttributes = "";

		// not_contenido
		$this->not_contenido->ViewValue = $this->not_contenido->CurrentValue;
		$this->not_contenido->ViewCustomAttributes = "";

		// not_imagen
		if (!ew_Empty($this->not_imagen->Upload->DbValue)) {
			$this->not_imagen->ViewValue = $this->not_imagen->Upload->DbValue;
		} else {
			$this->not_imagen->ViewValue = "";
		}
		$this->not_imagen->ViewCustomAttributes = "";

		// not_epi
		$this->not_epi->ViewValue = $this->not_epi->CurrentValue;
		$this->not_epi->ViewCustomAttributes = "";

		// not_audio
		if (!ew_Empty($this->not_audio->Upload->DbValue)) {
			$this->not_audio->ViewValue = $this->not_audio->Upload->DbValue;
		} else {
			$this->not_audio->ViewValue = "";
		}
		$this->not_audio->ViewCustomAttributes = "";

		// not_url
		$this->not_url->ViewValue = $this->not_url->CurrentValue;
		$this->not_url->ViewCustomAttributes = "";

		// not_publicar
		if (strval($this->not_publicar->CurrentValue) <> "") {
			$this->not_publicar->ViewValue = "";
			$arwrk = explode(",", strval($this->not_publicar->CurrentValue));
			$cnt = count($arwrk);
			for ($ari = 0; $ari < $cnt; $ari++) {
				switch (trim($arwrk[$ari])) {
					case $this->not_publicar->FldTagValue(1):
						$this->not_publicar->ViewValue .= $this->not_publicar->FldTagCaption(1) <> "" ? $this->not_publicar->FldTagCaption(1) : trim($arwrk[$ari]);
						break;
					default:
						$this->not_publicar->ViewValue .= trim($arwrk[$ari]);
				}
				if ($ari < $cnt-1) $this->not_publicar->ViewValue .= ew_ViewOptionSeparator($ari);
			}
		} else {
			$this->not_publicar->ViewValue = NULL;
		}
		$this->not_publicar->ViewCustomAttributes = "";

		// not_fecha_pub
		$this->not_fecha_pub->ViewValue = $this->not_fecha_pub->CurrentValue;
		$this->not_fecha_pub->ViewValue = ew_FormatDateTime($this->not_fecha_pub->ViewValue, 7);
		$this->not_fecha_pub->ViewCustomAttributes = "";

		// not_hora_pub
		$this->not_hora_pub->ViewValue = $this->not_hora_pub->CurrentValue;
		$this->not_hora_pub->ViewCustomAttributes = "";

		// not_fuente1
		if (strval($this->not_fuente1->CurrentValue) <> "") {
			$sFilterWrk = "`FuenteId`" . ew_SearchString("=", $this->not_fuente1->CurrentValue, EW_DATATYPE_NUMBER);
		$sSqlWrk = "SELECT `FuenteId`, `FuenteDescripcion` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `fuente`";
		$sWhereWrk = "";
		if ($sFilterWrk <> "") {
			ew_AddFilter($sWhereWrk, $sFilterWrk);
		}

		// Call Lookup selecting
		$this->Lookup_Selecting($this->not_fuente1, $sWhereWrk);
		if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$rswrk = $conn->Execute($sSqlWrk);
			if ($rswrk && !$rswrk->EOF) { // Lookup values found
				$this->not_fuente1->ViewValue = $rswrk->fields('DispFld');
				$rswrk->Close();
			} else {
				$this->not_fuente1->ViewValue = $this->not_fuente1->CurrentValue;
			}
		} else {
			$this->not_fuente1->ViewValue = NULL;
		}
		$this->not_fuente1->ViewCustomAttributes = "";

		// not_fuente
		$this->not_fuente->ViewValue = $this->not_fuente->CurrentValue;
		$this->not_fuente->ViewCustomAttributes = "";

		// not_galeria
		if (strval($this->not_galeria->CurrentValue) <> "") {
			$sFilterWrk = "`gal_id`" . ew_SearchString("=", $this->not_galeria->CurrentValue, EW_DATATYPE_NUMBER);
		$sSqlWrk = "SELECT `gal_id`, `gal_des` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `galerias`";
		$sWhereWrk = "";
		if ($sFilterWrk <> "") {
			ew_AddFilter($sWhereWrk, $sFilterWrk);
		}

		// Call Lookup selecting
		$this->Lookup_Selecting($this->not_galeria, $sWhereWrk);
		if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$rswrk = $conn->Execute($sSqlWrk);
			if ($rswrk && !$rswrk->EOF) { // Lookup values found
				$this->not_galeria->ViewValue = $rswrk->fields('DispFld');
				$rswrk->Close();
			} else {
				$this->not_galeria->ViewValue = $this->not_galeria->CurrentValue;
			}
		} else {
			$this->not_galeria->ViewValue = NULL;
		}
		$this->not_galeria->ViewCustomAttributes = "";

		// not_destacada
		if (strval($this->not_destacada->CurrentValue) <> "") {
			switch ($this->not_destacada->CurrentValue) {
				case $this->not_destacada->FldTagValue(1):
					$this->not_destacada->ViewValue = $this->not_destacada->FldTagCaption(1) <> "" ? $this->not_destacada->FldTagCaption(1) : $this->not_destacada->CurrentValue;
					break;
				case $this->not_destacada->FldTagValue(2):
					$this->not_destacada->ViewValue = $this->not_destacada->FldTagCaption(2) <> "" ? $this->not_destacada->FldTagCaption(2) : $this->not_destacada->CurrentValue;
					break;
				default:
					$this->not_destacada->ViewValue = $this->not_destacada->CurrentValue;
			}
		} else {
			$this->not_destacada->ViewValue = NULL;
		}
		$this->not_destacada->ViewCustomAttributes = "";

		// not_visitas
		$this->not_visitas->ViewValue = $this->not_visitas->CurrentValue;
		$this->not_visitas->ViewCustomAttributes = "";

		// not_publicar_index
		if (strval($this->not_publicar_index->CurrentValue) <> "") {
			switch ($this->not_publicar_index->CurrentValue) {
				case $this->not_publicar_index->FldTagValue(1):
					$this->not_publicar_index->ViewValue = $this->not_publicar_index->FldTagCaption(1) <> "" ? $this->not_publicar_index->FldTagCaption(1) : $this->not_publicar_index->CurrentValue;
					break;
				case $this->not_publicar_index->FldTagValue(2):
					$this->not_publicar_index->ViewValue = $this->not_publicar_index->FldTagCaption(2) <> "" ? $this->not_publicar_index->FldTagCaption(2) : $this->not_publicar_index->CurrentValue;
					break;
				default:
					$this->not_publicar_index->ViewValue = $this->not_publicar_index->CurrentValue;
			}
		} else {
			$this->not_publicar_index->ViewValue = NULL;
		}
		$this->not_publicar_index->ViewCustomAttributes = "";

		// not_autor
		$this->not_autor->ViewValue = $this->not_autor->CurrentValue;
		$this->not_autor->ViewCustomAttributes = "";

		// not_usuario
		if (strval($this->not_usuario->CurrentValue) <> "") {
			$sFilterWrk = "`usu_id`" . ew_SearchString("=", $this->not_usuario->CurrentValue, EW_DATATYPE_NUMBER);
		$sSqlWrk = "SELECT `usu_id`, `usu_nom` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `usuarios`";
		$sWhereWrk = "";
		if ($sFilterWrk <> "") {
			ew_AddFilter($sWhereWrk, $sFilterWrk);
		}

		// Call Lookup selecting
		$this->Lookup_Selecting($this->not_usuario, $sWhereWrk);
		if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$rswrk = $conn->Execute($sSqlWrk);
			if ($rswrk && !$rswrk->EOF) { // Lookup values found
				$this->not_usuario->ViewValue = $rswrk->fields('DispFld');
				$rswrk->Close();
			} else {
				$this->not_usuario->ViewValue = $this->not_usuario->CurrentValue;
			}
		} else {
			$this->not_usuario->ViewValue = NULL;
		}
		$this->not_usuario->ViewCustomAttributes = "";

		// not_relacionadas
		$this->not_relacionadas->ViewValue = $this->not_relacionadas->CurrentValue;
		$this->not_relacionadas->ViewCustomAttributes = "";

		// not_id
		$this->not_id->LinkCustomAttributes = "";
		$this->not_id->HrefValue = "";
		$this->not_id->TooltipValue = "";

		// not_fecha
		$this->not_fecha->LinkCustomAttributes = "";
		$this->not_fecha->HrefValue = "";
		$this->not_fecha->TooltipValue = "";

		// not_hora
		$this->not_hora->LinkCustomAttributes = "";
		$this->not_hora->HrefValue = "";
		$this->not_hora->TooltipValue = "";

		// not_seccion
		$this->not_seccion->LinkCustomAttributes = "";
		$this->not_seccion->HrefValue = "";
		$this->not_seccion->TooltipValue = "";

		// not_orden
		$this->not_orden->LinkCustomAttributes = "";
		$this->not_orden->HrefValue = "";
		$this->not_orden->TooltipValue = "";

		// not_copete
		$this->not_copete->LinkCustomAttributes = "";
		$this->not_copete->HrefValue = "";
		$this->not_copete->TooltipValue = "";

		// not_titulo
		$this->not_titulo->LinkCustomAttributes = "";
		$this->not_titulo->HrefValue = "";
		$this->not_titulo->TooltipValue = "";

		// not_resumens
		$this->not_resumens->LinkCustomAttributes = "";
		$this->not_resumens->HrefValue = "";
		$this->not_resumens->TooltipValue = "";

		// not_contenido
		$this->not_contenido->LinkCustomAttributes = "";
		$this->not_contenido->HrefValue = "";
		$this->not_contenido->TooltipValue = "";

		// not_imagen
		$this->not_imagen->LinkCustomAttributes = "";
		$this->not_imagen->HrefValue = "";
		$this->not_imagen->HrefValue2 = $this->not_imagen->UploadPath . $this->not_imagen->Upload->DbValue;
		$this->not_imagen->TooltipValue = "";

		// not_epi
		$this->not_epi->LinkCustomAttributes = "";
		$this->not_epi->HrefValue = "";
		$this->not_epi->TooltipValue = "";

		// not_audio
		$this->not_audio->LinkCustomAttributes = "";
		$this->not_audio->HrefValue = "";
		$this->not_audio->HrefValue2 = $this->not_audio->UploadPath . $this->not_audio->Upload->DbValue;
		$this->not_audio->TooltipValue = "";

		// not_url
		$this->not_url->LinkCustomAttributes = "";
		$this->not_url->HrefValue = "";
		$this->not_url->TooltipValue = "";

		// not_publicar
		$this->not_publicar->LinkCustomAttributes = "";
		$this->not_publicar->HrefValue = "";
		$this->not_publicar->TooltipValue = "";

		// not_fecha_pub
		$this->not_fecha_pub->LinkCustomAttributes = "";
		$this->not_fecha_pub->HrefValue = "";
		$this->not_fecha_pub->TooltipValue = "";

		// not_hora_pub
		$this->not_hora_pub->LinkCustomAttributes = "";
		$this->not_hora_pub->HrefValue = "";
		$this->not_hora_pub->TooltipValue = "";

		// not_fuente1
		$this->not_fuente1->LinkCustomAttributes = "";
		$this->not_fuente1->HrefValue = "";
		$this->not_fuente1->TooltipValue = "";

		// not_fuente
		$this->not_fuente->LinkCustomAttributes = "";
		$this->not_fuente->HrefValue = "";
		$this->not_fuente->TooltipValue = "";

		// not_galeria
		$this->not_galeria->LinkCustomAttributes = "";
		$this->not_galeria->HrefValue = "";
		$this->not_galeria->TooltipValue = "";

		// not_destacada
		$this->not_destacada->LinkCustomAttributes = "";
		$this->not_destacada->HrefValue = "";
		$this->not_destacada->TooltipValue = "";

		// not_visitas
		$this->not_visitas->LinkCustomAttributes = "";
		$this->not_visitas->HrefValue = "";
		$this->not_visitas->TooltipValue = "";

		// not_publicar_index
		$this->not_publicar_index->LinkCustomAttributes = "";
		$this->not_publicar_index->HrefValue = "";
		$this->not_publicar_index->TooltipValue = "";

		// not_autor
		$this->not_autor->LinkCustomAttributes = "";
		$this->not_autor->HrefValue = "";
		$this->not_autor->TooltipValue = "";

		// not_usuario
		$this->not_usuario->LinkCustomAttributes = "";
		$this->not_usuario->HrefValue = "";
		$this->not_usuario->TooltipValue = "";

		// not_relacionadas
		$this->not_relacionadas->LinkCustomAttributes = "";
		$this->not_relacionadas->HrefValue = "";
		$this->not_relacionadas->TooltipValue = "";

		// Call Row Rendered event
		$this->Row_Rendered();
	}

	// Aggregate list row values
	function AggregateListRowValues() {
	}

	// Aggregate list row (for rendering)
	function AggregateListRow() {
	}

	// Export data in HTML/CSV/Word/Excel/Email/PDF format
	function ExportDocument(&$Doc, &$Recordset, $StartRec, $StopRec, $ExportPageType = "") {
		if (!$Recordset || !$Doc)
			return;

		// Write header
		$Doc->ExportTableHeader();
		if ($Doc->Horizontal) { // Horizontal format, write header
			$Doc->BeginExportRow();
			if ($ExportPageType == "view") {
				if ($this->not_id->Exportable) $Doc->ExportCaption($this->not_id);
				if ($this->not_fecha->Exportable) $Doc->ExportCaption($this->not_fecha);
				if ($this->not_hora->Exportable) $Doc->ExportCaption($this->not_hora);
				if ($this->not_seccion->Exportable) $Doc->ExportCaption($this->not_seccion);
				if ($this->not_orden->Exportable) $Doc->ExportCaption($this->not_orden);
				if ($this->not_copete->Exportable) $Doc->ExportCaption($this->not_copete);
				if ($this->not_titulo->Exportable) $Doc->ExportCaption($this->not_titulo);
				if ($this->not_resumens->Exportable) $Doc->ExportCaption($this->not_resumens);
				if ($this->not_contenido->Exportable) $Doc->ExportCaption($this->not_contenido);
				if ($this->not_imagen->Exportable) $Doc->ExportCaption($this->not_imagen);
				if ($this->not_epi->Exportable) $Doc->ExportCaption($this->not_epi);
				if ($this->not_audio->Exportable) $Doc->ExportCaption($this->not_audio);
				if ($this->not_url->Exportable) $Doc->ExportCaption($this->not_url);
				if ($this->not_fecha_pub->Exportable) $Doc->ExportCaption($this->not_fecha_pub);
				if ($this->not_hora_pub->Exportable) $Doc->ExportCaption($this->not_hora_pub);
				if ($this->not_fuente1->Exportable) $Doc->ExportCaption($this->not_fuente1);
				if ($this->not_galeria->Exportable) $Doc->ExportCaption($this->not_galeria);
				if ($this->not_destacada->Exportable) $Doc->ExportCaption($this->not_destacada);
				if ($this->not_visitas->Exportable) $Doc->ExportCaption($this->not_visitas);
				if ($this->not_publicar_index->Exportable) $Doc->ExportCaption($this->not_publicar_index);
				if ($this->not_usuario->Exportable) $Doc->ExportCaption($this->not_usuario);
				if ($this->not_relacionadas->Exportable) $Doc->ExportCaption($this->not_relacionadas);
			} else {
				if ($this->not_id->Exportable) $Doc->ExportCaption($this->not_id);
				if ($this->not_fecha->Exportable) $Doc->ExportCaption($this->not_fecha);
				if ($this->not_hora->Exportable) $Doc->ExportCaption($this->not_hora);
				if ($this->not_seccion->Exportable) $Doc->ExportCaption($this->not_seccion);
				if ($this->not_orden->Exportable) $Doc->ExportCaption($this->not_orden);
				if ($this->not_copete->Exportable) $Doc->ExportCaption($this->not_copete);
				if ($this->not_titulo->Exportable) $Doc->ExportCaption($this->not_titulo);
				if ($this->not_imagen->Exportable) $Doc->ExportCaption($this->not_imagen);
				if ($this->not_epi->Exportable) $Doc->ExportCaption($this->not_epi);
				if ($this->not_audio->Exportable) $Doc->ExportCaption($this->not_audio);
				if ($this->not_url->Exportable) $Doc->ExportCaption($this->not_url);
				if ($this->not_fecha_pub->Exportable) $Doc->ExportCaption($this->not_fecha_pub);
				if ($this->not_hora_pub->Exportable) $Doc->ExportCaption($this->not_hora_pub);
				if ($this->not_fuente1->Exportable) $Doc->ExportCaption($this->not_fuente1);
				if ($this->not_fuente->Exportable) $Doc->ExportCaption($this->not_fuente);
				if ($this->not_galeria->Exportable) $Doc->ExportCaption($this->not_galeria);
				if ($this->not_destacada->Exportable) $Doc->ExportCaption($this->not_destacada);
				if ($this->not_visitas->Exportable) $Doc->ExportCaption($this->not_visitas);
				if ($this->not_publicar_index->Exportable) $Doc->ExportCaption($this->not_publicar_index);
				if ($this->not_autor->Exportable) $Doc->ExportCaption($this->not_autor);
				if ($this->not_usuario->Exportable) $Doc->ExportCaption($this->not_usuario);
				if ($this->not_relacionadas->Exportable) $Doc->ExportCaption($this->not_relacionadas);
			}
			$Doc->EndExportRow();
		}

		// Move to first record
		$RecCnt = $StartRec - 1;
		if (!$Recordset->EOF) {
			$Recordset->MoveFirst();
			if ($StartRec > 1)
				$Recordset->Move($StartRec - 1);
		}
		while (!$Recordset->EOF && $RecCnt < $StopRec) {
			$RecCnt++;
			if (intval($RecCnt) >= intval($StartRec)) {
				$RowCnt = intval($RecCnt) - intval($StartRec) + 1;

				// Page break
				if ($this->ExportPageBreakCount > 0) {
					if ($RowCnt > 1 && ($RowCnt - 1) % $this->ExportPageBreakCount == 0)
						$Doc->ExportPageBreak();
				}
				$this->LoadListRowValues($Recordset);

				// Render row
				$this->RowType = EW_ROWTYPE_VIEW; // Render view
				$this->ResetAttrs();
				$this->RenderListRow();
				$Doc->BeginExportRow($RowCnt); // Allow CSS styles if enabled
				if ($ExportPageType == "view") {
					if ($this->not_id->Exportable) $Doc->ExportField($this->not_id);
					if ($this->not_fecha->Exportable) $Doc->ExportField($this->not_fecha);
					if ($this->not_hora->Exportable) $Doc->ExportField($this->not_hora);
					if ($this->not_seccion->Exportable) $Doc->ExportField($this->not_seccion);
					if ($this->not_orden->Exportable) $Doc->ExportField($this->not_orden);
					if ($this->not_copete->Exportable) $Doc->ExportField($this->not_copete);
					if ($this->not_titulo->Exportable) $Doc->ExportField($this->not_titulo);
					if ($this->not_resumens->Exportable) $Doc->ExportField($this->not_resumens);
					if ($this->not_contenido->Exportable) $Doc->ExportField($this->not_contenido);
					if ($this->not_imagen->Exportable) $Doc->ExportField($this->not_imagen);
					if ($this->not_epi->Exportable) $Doc->ExportField($this->not_epi);
					if ($this->not_audio->Exportable) $Doc->ExportField($this->not_audio);
					if ($this->not_url->Exportable) $Doc->ExportField($this->not_url);
					if ($this->not_fecha_pub->Exportable) $Doc->ExportField($this->not_fecha_pub);
					if ($this->not_hora_pub->Exportable) $Doc->ExportField($this->not_hora_pub);
					if ($this->not_fuente1->Exportable) $Doc->ExportField($this->not_fuente1);
					if ($this->not_galeria->Exportable) $Doc->ExportField($this->not_galeria);
					if ($this->not_destacada->Exportable) $Doc->ExportField($this->not_destacada);
					if ($this->not_visitas->Exportable) $Doc->ExportField($this->not_visitas);
					if ($this->not_publicar_index->Exportable) $Doc->ExportField($this->not_publicar_index);
					if ($this->not_usuario->Exportable) $Doc->ExportField($this->not_usuario);
					if ($this->not_relacionadas->Exportable) $Doc->ExportField($this->not_relacionadas);
				} else {
					if ($this->not_id->Exportable) $Doc->ExportField($this->not_id);
					if ($this->not_fecha->Exportable) $Doc->ExportField($this->not_fecha);
					if ($this->not_hora->Exportable) $Doc->ExportField($this->not_hora);
					if ($this->not_seccion->Exportable) $Doc->ExportField($this->not_seccion);
					if ($this->not_orden->Exportable) $Doc->ExportField($this->not_orden);
					if ($this->not_copete->Exportable) $Doc->ExportField($this->not_copete);
					if ($this->not_titulo->Exportable) $Doc->ExportField($this->not_titulo);
					if ($this->not_imagen->Exportable) $Doc->ExportField($this->not_imagen);
					if ($this->not_epi->Exportable) $Doc->ExportField($this->not_epi);
					if ($this->not_audio->Exportable) $Doc->ExportField($this->not_audio);
					if ($this->not_url->Exportable) $Doc->ExportField($this->not_url);
					if ($this->not_fecha_pub->Exportable) $Doc->ExportField($this->not_fecha_pub);
					if ($this->not_hora_pub->Exportable) $Doc->ExportField($this->not_hora_pub);
					if ($this->not_fuente1->Exportable) $Doc->ExportField($this->not_fuente1);
					if ($this->not_fuente->Exportable) $Doc->ExportField($this->not_fuente);
					if ($this->not_galeria->Exportable) $Doc->ExportField($this->not_galeria);
					if ($this->not_destacada->Exportable) $Doc->ExportField($this->not_destacada);
					if ($this->not_visitas->Exportable) $Doc->ExportField($this->not_visitas);
					if ($this->not_publicar_index->Exportable) $Doc->ExportField($this->not_publicar_index);
					if ($this->not_autor->Exportable) $Doc->ExportField($this->not_autor);
					if ($this->not_usuario->Exportable) $Doc->ExportField($this->not_usuario);
					if ($this->not_relacionadas->Exportable) $Doc->ExportField($this->not_relacionadas);
				}
				$Doc->EndExportRow();
			}
			$Recordset->MoveNext();
		}
		$Doc->ExportTableFooter();
	}

	// Table level events
	// Recordset Selecting event
	function Recordset_Selecting(&$filter) {

		// Enter your code here	
	}

	// Recordset Selected event
	function Recordset_Selected(&$rs) {

		//echo "Recordset Selected";
	}

	// Recordset Search Validated event
	function Recordset_SearchValidated() {

		// Example:
		//$this->MyField1->AdvancedSearch->SearchValue = "your search criteria"; // Search value

	}

	// Recordset Searching event
	function Recordset_Searching(&$filter) {

		// Enter your code here	
	}

	// Row_Selecting event
	function Row_Selecting(&$filter) {

		// Enter your code here	
	}

	// Row Selected event
	function Row_Selected(&$rs) {

		//echo "Row Selected";
	}

	// Row Inserting event
	function Row_Inserting($rsold, &$rsnew) {
	$rs =& $rsnew;

	    // Enter your code here
	    // To cancel, set return value to FALSE      

	    $rs["not_autor"]=CurrentUserName();   

	   // echo     CurrentUserName();die();
	    return TRUE;
	}

	// Row Inserted event
	function Row_Inserted($rsold, &$rsnew) {

		//echo "Row Inserted"
	}

	// Row Updating event
	function Row_Updating($rsold, &$rsnew) {

		// Enter your code here
		// To cancel, set return value to FALSE

		return TRUE;
	}

	// Row Updated event
	function Row_Updated($rsold, &$rsnew) {

		//echo "Row Updated";
	}

	// Row Update Conflict event
	function Row_UpdateConflict($rsold, &$rsnew) {

		// Enter your code here
		// To ignore conflict, set return value to FALSE

		return TRUE;
	}

	// Row Deleting event
	function Row_Deleting(&$rs) {

		// Enter your code here
		// To cancel, set return value to False

		return TRUE;
	}

	// Row Deleted event
	function Row_Deleted(&$rs) {

		//echo "Row Deleted";
	}

	// Email Sending event
	function Email_Sending(&$Email, &$Args) {

		//var_dump($Email); var_dump($Args); exit();
		return TRUE;
	}

	// Lookup Selecting event
	function Lookup_Selecting($fld, &$filter) {

		// Enter your code here
	}

	// Row Rendering event
	function Row_Rendering() {

		// Enter your code here	
	}

	// Row Rendered event
	function Row_Rendered() {

		// To view properties of field class, use:
		//var_dump($this-><FieldName>); 

	}

	// User ID Filtering event
	function UserID_Filtering(&$filter) {

		// Enter your code here
	}
}
?>
